package com.bohua.child.controller;

import com.bohua.child.common.Lay;
import com.bohua.child.common.Msg;
import com.bohua.child.entity.Course;
import com.bohua.child.service.CourseService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
/**
 * 课程表控制器
 * @author shichenyang
 * @email gyv12345@163.com
 * @date 2019/01/17
 */
@Controller
@RequestMapping("/course")
public class CourseController {
    @Resource
    private CourseService courseService;

    @RequestMapping
    public String course(){
        return "course/course.html";
    }
    @RequestMapping("/add")
    public String add(){
        return "course/addCourse.html";
    }

    @RequestMapping("/update")
    public String update(){
        return "course/updateCourse.html";
    }

    @RequestMapping("/getCourses")
    @ResponseBody
    public Lay getCourses(Course course,Integer page,Integer limit){
        return courseService.getCourses(course,page,limit);
    }
    @RequestMapping("/addCourse")
    @ResponseBody
    public Msg addCourse(Course course){
        return courseService.addCourse(course);
    }

    @RequestMapping("/updateCourse")
    @ResponseBody
    public Msg updateCourse(Course course){
        return courseService.updateCourse(course);
    }

    @RequestMapping("/delCourse")
    @ResponseBody
    public Msg delCourse(Course course){
        return courseService.delCourse(course);
    }
}
